<template>

  <el-row >
  <el-checkbox-group v-model="checkList" >
    <el-col :span="24">
    <div v-for="item in  options" :key="item.code" >
      <el-checkbox  :label="item.code">
       {{item.code}}: <el-input style="width:114%" v-model="item.title" ></el-input>
    </el-checkbox>
    </div>
    </el-col>
  </el-checkbox-group>
</el-row>

</template>

<script>
export default {
  name: 'checkbox',
  data () {
    return {
      checkList: [],
      options: [
        {
          code: 'A',
          title: '',
          img: '1',
          isRight: 'false'
        },
        {
          code: 'B',
          title: '',
          img: '1',
          isRight: 'false'
        },
        {
          code: 'C',
          title: '',
          img: '1',
          isRight: 'false'
        },
        {
          code: 'D',
          title: '',
          img: '1',
          isRight: 'false'
        }
      ]
    }
  },
  methods: {
    confirm () {
      return this.options.map(item => {
        let isRight
        if (this.checkList.includes(item.code)) {
          isRight = 1
        } else {
          isRight = 0
        }
        return {
          ...item,
          isRight
        }
      })
    }
  }
}
</script>

<style scoped>
.el-col {
  margin-bottom: 30px;
 }
</style>
